package com.luckyzhang.day2;

import com.luckyzhang.day2.bean.Leifeng;
import com.luckyzhang.day2.method2Factory.ConcreateFactoryA;
import com.luckyzhang.day2.method2Factory.ConcreateProductA;
import com.luckyzhang.day2.methodFactory.ICreateFactory;
import com.luckyzhang.day2.methodFactory.YoungPionnerFactory;
import com.luckyzhang.day2.simpleFactory.SimpleLeifengFactory;

public class FactoryMain {

    public static void main(String[] args) {
        //简单工程模式
        Leifeng leifeng1 = SimpleLeifengFactory.createLeifeng(0);
        leifeng1.clean();
        Leifeng leifeng2 = SimpleLeifengFactory.createLeifeng(0);
        leifeng2.sweep();
        Leifeng leifeng3 = SimpleLeifengFactory.createLeifeng(0);
        leifeng3.wash();

        //工厂方法
        ICreateFactory iCreateFactory = new YoungPionnerFactory();
        Leifeng factory = iCreateFactory.createFactory();
        factory.wash();
        factory.sweep();
        factory.clean();

        //工厂方法2
        ConcreateFactoryA concreateFactoryA = new ConcreateFactoryA();
        ConcreateProductA concreateProductA = concreateFactoryA.createFactory(ConcreateProductA.class);
        concreateProductA.method();

    }
}
